package com.pine.dcts.service;


import com.pine.dcts.DctsEngine;
import com.pine.dcts.common.TaskStatusType;

/**
 * @author xiaoyuan
 * @create 2021/1/15 16:52
 **/
public class DataxTaskRunner extends TaskRunner {


    public DataxTaskRunner(Task task, TaskRunnerCallback callback) {
        super(task, callback);
    }

    @Override
    public void run() {
        callback.setTaskStatus(TaskStatusType.RUNNING);
        callback.callback();
        callback.callback();
        try {
            new DctsEngine().start(this.task.getTaskMeta().getTaskConfig());
            callback.setTaskStatus(TaskStatusType.FINISH);
        } catch (Throwable throwable) {
            callback.setTaskStatus(TaskStatusType.ERROR);
        } finally {
            callback.callback();
        }
    }
}
